// 流程创建
import modifySenders from '@/components/Common/auditProcess/module/modifySenders';
import { mapState } from 'vuex';

export default {
  components: {
    modifySenders
  },
  data() {
    return {
      version: 0,
      isModifyForm: 0,
      modifySenders: [],
      modifyNodeId: ''// 修改节点id
    };
  },
  computed: {
    ...mapState({
      'showMobilePage': state => state.app.showMobilePage
    })
  },
  created() {
    this.isModifyForm = Number(this.$route.query.isModifyForm) || 0;
    this.currentProcessIndex = Number(this.$route.query.currentProcessIndex) || -1;
    this.modifyNodeId = Number(this.$route.query.modifyNodeId) || '';
  },
  methods: {
    // 节点修改添加参数
    handleModifyData(data) {
      data.version = this.version;
      data.isModifyForm = this.isModifyForm;
      if (this.isModifyForm) {
        data.modifyNodeId = this.modifyNodeId;
        data.modifySenderIds = this.modifySenders.map(el => el.id).join(',');
      }
    },
    // 节点修改，流程变更跳转详情页
    nodeModifyJumpDetail({ routeName = '', params = {}, query = {}}) {
      this.$router.push({
        name: routeName,
        params,
        query
      });
    }
  }
};
